// this do-file reproduces Table A.1
version 14
use "data/compare_sample.dta" , clear


g str40 varname = ""
g outinfot = .
g outinfoc = .


local numvar = 1

foreach X in bgy_pop urban  herf_religion herf_ethnic bgy_elem_school bgy_high_school bgy_market bgy_healthcentre bgy_waterworks{ 


	local numstd = `numvar' + 1
	qui summ `X' if in_sample==1
	replace outinfot = r(mean) in `numvar'
	replace outinfot =  r(sd) in `numstd'
	replace varname = "`X'" in `numvar'
	
	qui summ `X' 
	replace outinfoc = r(mean) in `numvar'
	replace outinfoc =  r(sd) in `numstd'
	replace varname = "`X'" in `numvar'
			
	local numvar = `numvar' + 2

}

format outinfot outinfoc      %9.2f

foreach X in outinfot outinfoc   {

	generate test = "(" + string(`X'  ,"%9.2f")  + ")" if varname==""
	tostring `X'  , replace force format("%9.2f")
	replace `X'  = test if varname==""
	drop test

}



preserve
keep varnam  outinfot outinfoc     
drop if outinfot=="(.)"
logout  , save(results/table_a_1.tex) clear tex replace dec(2)
restore
drop varnam  outinfot outinfoc   
